<style>
    {% if modify == 1 %}
    body{
        background-color: #F9F9F9;
    }
    {% endif %}
    .xh-form tr td:nth-child(2n){
        padding: 5px 20px 5px 0;
        width: 200px;
    }
    td>label{
        margin-right: 10px;
        float: right;
    }
</style>
<script>
    var apply_data = {{ applyData }};
    var modify = {{ modify }};
    var iId = {{ iId }};
    var existApp = {{ app }};
</script>
<form id="reference_apply_form" class="xh-form"  method="post">
    <div class="xh-area-form">
        <table style="width: 100%">
            <tr style="display: none">
            </tr>
            {% if modify == 2 %}<!-- 修改 -->
                <tr>
                    <td style="align-self: left"><label>学校：</label></td><td ><select id="school" style="width: 180px" class="form-control" name="school"><option value="" selected>请选择</option></select></td>
                    <td ><label>应用：</label></td><td ><select id="application" style="width: 180px" class="form-control" name="application"><option value="" selected>请选择</option></select></td>
                    <td ><label>年级：</label></td><td ><select id="class" style="width: 180px" class="form-control" name="class"><option value="" selected>请选择</option></select></td>
                </tr>
                <tr>
                    <td ><label>教辅年级：</label></td>
                    <td >
                        <select id="volume" name="volume" style="width: 180px" class="form-control">
                            <option value="1">上册</option>
                            <option value="2">下册</option>
                            <option value="3">全册</option>
                        </select>
                    </td>
                    <td ><label>科目：</label></td><td ><select id="subject" style="width: 180px" class="form-control"  name="subject"><option value="" selected>请选择</option></select></td>
                    <td ><label>教师：</label></td><td ><select id="teacher" style="width: 180px" class="form-control" name="teacher"></select></td>
                </tr>
                <tr>
                    <td ><label>教辅书名：</label></td><td>
                        {% if applyDataArr['sBookName'] %}
                            <input id="bookName" name="bookName" type="text" value="{{ applyDataArr['sBookName'] }}" autocomplete="off">
                        {% else %}
                            <input id="bookName" name="bookName" type="text" placeholder="必填" autocomplete="off">
                        {% endif %}
                    </td>
                    <td>
                        <label style="color: red">书id列表:</label>
                    </td>
                    <td >
                        <select id="bookIdArr" class="form-control"></select>
                    </td>
                    <td colspan="2" align="left">
                        <a id="addBookId" class="btn btn-sm btn-success pull-left" >添加</a>
                    </td>
                </tr>
                <tr>
                    <td ><label>教辅ID：</label></td><td>
                        {% if applyDataArr['iBookId'] %}
                            <input id="referenceId" name="referenceId" type="text" value="{{ applyDataArr['iBookId'] }}" autocomplete="off">
                        {% else %}
                            <input id="referenceId" name="referenceId" type="text" autocomplete="off">
                        {% endif %}
                    </td>
                    <td ><label>是否存在：</label></td><td>
                        {% if applyDataArr['bExistBookId'] == 1 %}
                            <select id="haveId" name="haveId" style="width: 180px" class="form-control">
                                <option value="1">否</option>
                                <option value="2" selected>是</option>
                            </select>
                        {% else %}
                            <select id="haveId" style="width: 180px" class="form-control" name="haveId">
                                <option value="1">否</option>
                                <option value="2">是</option>
                            </select>
                        {% endif %}
                    </td>
                </tr>
                {#{% if applyDataArr['bExistBookId'] == 1 %}#}
                    {#<tr id = remark_1>#}
                        {#<td><label>备注：</label></td>#}
                        {#<td colspan="3" style="width: 475px;"><textarea style="height:50px" id="remark" name="remark" type="text" >{{ applyDataArr['sRemark'] }}</textarea></td>#}
                    {#</tr>#}
                {#{% else %}#}
                {% if applyDataArr['bExistBookId'] == 1 %}
                    <table id="showOrDisplay" style="display: none">
                {% else %}
                    <table id="showOrDisplay" style="display: table-cell">
                {% endif %}

                <tr id = isNo_1>
                    <td style="width: 95px;"><label style="float: right;">录入需求：</label></td><td colspan="5" style="width: 200px;"><textarea style="height:50px" id="typeIn" name="typeIn" class="form-control" type="text" placeholder="必填">{{ applyDataArr['sTypeIn'] }}</textarea></td>
                </tr>
                <tr id = isNo_2>
                    <td><label>当前进度：</label></td><td colspan="5" style="width: 200px;"><textarea style="height:50px" id="progress" name="progress" class="form-control" type="text" placeholder="当前教学进度，必填">{{ applyDataArr['sProgress'] }}</textarea></td>
                </tr>
                <tr id = isNo_6>
                    <td><label>教学进度：</label></td><td colspan="5" style="width: 200px;"><textarea style="height:50px" id="teachProgress" name="teachProgress" class="form-control" type="text" placeholder="两周后教学进度，必填">{{ applyDataArr['sTeachProgress'] }}</textarea></td>
                </tr>
                <tr id = isNo_3>
                    {% if applyDataArr['bPaperBook'] ==1 %}
                        <td ><label>是否纸质：</label></td><td><select id="isPaper" class="form-control" name="isPaper"><option value="1">否</option> <option value="2" selected>是</option></select></td>
                    {% else %}
                        <td ><label>是否纸质：</label></td><td><select id="isPaper" class="form-control" name="isPaper"><option value="1">否</option> <option value="2">是</option></select></td>
                    {% endif %}
                    {% if applyDataArr['bElectronic'] %}
                        <td ><label>电子教辅：</label></td><td><select id="electronic" class="form-control" name="electronic"><option value="1">否</option> <option value="2" selected>是</option></select></td>
                    {% else %}
                        <td ><label>电子教辅：</label></td><td><select id="electronic" class="form-control" name="electronic"><option value="1">否</option> <option value="2">是</option></select></td>
                    {% endif %}
                    <td ><label>教辅数量：</label></td><td><input id="bookNum" class="form-control" name="bookNum" type="text" value="{{ applyDataArr['iReferenceNum'] }}" autocomplete="off"></td>
                </tr>
                <tr id = isNo_4>
                    <td ><label>购买链接：</label></td><td colspan="5"><input id="buyUrl" class="form-control" name="buyUrl" type="text" value="{{ applyDataArr['sBuyUrl'] }}" placeholder="必填" autocomplete="off"></td>
                </tr>
            </table>
            <table>
                <tr id = isNo_5>
                    <td style="width: 95px"><label>备注：</label></td><td colspan="5" style="width: 750px"><textarea style="height:50px" id="remark" name="remark" class="form-control" type="text">{{ applyDataArr['sRemark'] }}</textarea></td>
                </tr>
            </table>

                {#{% endif %}#}
            {% else %}<!-- 新建 -->
                <tr>
                    <td ><label>学校：</label></td><td ><select id="school" style="width: 150px" class="form-control" name="school"><option value="" selected>请选择</option></select></td>
                    <td ><label>应用：</label></td><td ><select id="application" style="width: 160px" class="form-control" name="application"><option value="" selected>请选择</option></select></td>
                    <td ><label>年级：</label></td><td ><select id="class" style="width: 170px" class="form-control" name="class"><option value="" selected>请选择</option></select></td>
                </tr>
                <tr>
                    <td ><label>教辅年级：</label></td>
                    <td >
                        <select id="volume" name="volume" style="width: 150px" class="form-control">
                            <option value="1">上册</option>
                            <option value="2">下册</option>
                            <option value="3">全册</option>
                        </select>
                    </td>
                    <td ><label>科目：</label></td><td ><select id="subject" style="width: 160px" class="form-control"  name="subject"><option value="" selected>请选择</option></select></td>
                    <td ><label>教师：</label></td><td ><select id="teacher" style="width: 170px" class="form-control" name="teacher"></select></td>
                </tr>
                <tr>
                    <td ><label>是否存在：</label></td><td>
                        {% if existData %}
                            <select id="haveId" name="haveId" style="width: 150px" class="form-control" disabled="disabled">
                                <option value="1">否</option>
                                <option value="2" selected>是</option>
                            </select>
                        {% else %}
                            <select id="haveId" style="width: 150px" class="form-control" name="haveId">
                                <option value="1">否</option>
                                <option value="2">是</option>
                            </select>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td ><label>教辅书名：</label></td><td>
                        {% if existData %}
                            <input id="bookName" name="bookName" type="text" value="{{ bookName }}" disabled="disabled" autocomplete="off">
                        {% else %}
                            <input id="bookName" name="bookName" type="text" placeholder="必填" autocomplete="off">
                        {% endif %}
                    </td>
                    <td ><label>教辅ID：</label></td><td>
                        {% if existData %}
                            <input id="referenceId" name="referenceId" type="text" value="{{ bookId }}" disabled="disabled" autocomplete="off">
                        {% else %}
                            <input id="referenceId" name="referenceId" type="text" disabled="disabled" autocomplete="off">
                        {% endif %}
                    </td>
                    <td colspan="2">
                        <a id="addApp" class="btn btn-sm btn-success pull-left" style="display: none">匹配应用</a>
                    </td>
                </tr>
                {% if existData %}
                    <tr id = remark_1>
                        <td><label>备注：</label></td>
                        <td colspan="3" style="width: 475px;"><textarea style="height:50px" id="remark" name="remark" type="text"></textarea></td>
                    </tr>
                {% else %}
                    <tr id = isNo_1>
                        <td><label>录入需求：</label></td><td colspan="5" style="width: 200px;"><textarea style="height:50px" id="typeIn" name="typeIn" class="form-control" type="text" placeholder="必填"></textarea></td>
                    </tr>
                    <tr id = isNo_2>
                        <td><label>当前进度：</label></td><td colspan="5" style="width: 200px;"><textarea style="height:50px" id="progress" name="progress" class="form-control" type="text" placeholder="当前教学进度，必填"></textarea></td>
                    </tr>
                    <tr id = isNo_6>
                        <td><label>教学进度：</label></td><td colspan="5" style="width: 200px;"><textarea style="height:50px" id="teachProgress" name="teachProgress" class="form-control" type="text" placeholder="两周后教学进度，必填"></textarea></td>
                    </tr>
                    <tr id = isNo_3>
                        <td ><label>是否纸质：</label></td><td><select id="isPaper" class="form-control" name="isPaper"><option value="1">否</option> <option value="2">是</option></select></td>
                        <td ><label>电子教辅：</label></td><td><select id="electronic" class="form-control" name="electronic"><option value="1">否</option> <option value="2">是</option></select></td>
                        <td ><label>教辅数量：</label></td><td><input id="bookNum" class="form-control" name="bookNum" type="text" autocomplete="off"></td>
                    </tr>
                    <tr id = isNo_4>
                        <td ><label>购买链接：</label></td><td colspan="5"><input id="buyUrl" class="form-control" name="buyUrl" type="text" placeholder="必填" autocomplete="off"></td>
                    </tr>
                    <tr id = isNo_5>
                        <td><label>备注：</label></td><td colspan="5" style="width: 100px;"><textarea style="height:50px" id="remark" name="remark" class="form-control" type="text"></textarea></td>
                    </tr>
                {% endif %}
            {% endif %}

        </table>
    </div>
</form>